<?php

require_once 'Zend/View/Helper/Abstract.php';

class Core_View_Helper_Interface_LoadDefaultDesign extends Zend_View_Helper_Abstract
{
    /**
     *
     */
    public function loadDefaultDesign()
    {
        $mdlDesign = new Model_Design();
        $design = $mdlDesign->getDefaultDesign();
        $mdlDesign->setDesign($design->id);

        //todo: this is duplicated in the builder

        //the design model returns the stylesheets organized by skin
        $skins = $mdlDesign->getStylesheets();
        if (is_array($skins)) {
            foreach ($skins as $skin => $styles) {
                if (is_array($styles)) {
                    foreach ($styles as $style) {
                        $this->view->headLink()->appendStylesheet('/skins/' . $skin . '/styles/' . $style);
                    }
                }
            }
        }

        $this->view->layout = $mdlDesign->getLayout();
    }
}